{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Execute this cell to install dependencies\n",
    "%pip install sf-hamilton[visualization]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example of using with_columns for Polars DataFrame [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/dagworks-inc/hamilton/blob/main/examples/polars/with_columns/notebook.ipynb) [![GitHub badge](https://img.shields.io/badge/github-view_source-2b3137?logo=github)](https://github.com/apache/hamilton/blob/main/examples/polars/with_columns/notebook.ipynb)\n",
    "\n",
    "This allows you to efficiently run groups of map operations on a dataframe.\n",
    "Here's an example of calling it -- if you've seen `@subdag`, you should be familiar with the concepts."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/jernejfrank/miniconda3/envs/hamilton/lib/python3.10/site-packages/pyspark/pandas/__init__.py:50: UserWarning: 'PYARROW_IGNORE_TIMEZONE' environment variable was not set. It is required to set this environment variable to '1' in both driver and executor sides if you use pyarrow>=2.0.0. pandas-on-Spark will set it for you but it does not work if there is a Spark context already launched.\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "%reload_ext hamilton.plugins.jupyter_magic\n",
    "from hamilton import driver\n",
    "import my_functions\n",
    "\n",
    "my_builder = driver.Builder().with_modules(my_functions).with_config({\"case\":\"thousands\"})\n",
    "output_node = [\"final_df\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 12.1.2 (20240928.0832)\n",
       " -->\n",
       "<!-- Pages: 1 -->\n",
       "<svg width=\"1323pt\" height=\"521pt\"\n",
       " viewBox=\"0.00 0.00 1322.70 520.92\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 516.92)\">\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-516.92 1318.7,-516.92 1318.7,4 -4,4\"/>\n",
       "<g id=\"clust1\" class=\"cluster\">\n",
       "<title>cluster__legend</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"8,-142 8,-326 92.85,-326 92.85,-142 8,-142\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-308.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
       "</g>\n",
       "<!-- case -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>case</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"83.55,-50 11.3,-50 11.3,0 89.55,0 89.55,-44 83.55,-50\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"83.55,-50 83.55,-44\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"89.55,-44 83.55,-44\"/>\n",
       "<text text-anchor=\"start\" x=\"35.42\" y=\"-33.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">case</text>\n",
       "<text text-anchor=\"start\" x=\"19.3\" y=\"-5.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">thousands</text>\n",
       "</g>\n",
       "<!-- final_df.spend -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>final_df.spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M231.45,-311.8C231.45,-311.8 142.35,-311.8 142.35,-311.8 136.35,-311.8 130.35,-305.8 130.35,-299.8 130.35,-299.8 130.35,-260.2 130.35,-260.2 130.35,-254.2 136.35,-248.2 142.35,-248.2 142.35,-248.2 231.45,-248.2 231.45,-248.2 237.45,-248.2 243.45,-254.2 243.45,-260.2 243.45,-260.2 243.45,-299.8 243.45,-299.8 243.45,-305.8 237.45,-311.8 231.45,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"141.15\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend</text>\n",
       "<text text-anchor=\"start\" x=\"167.77\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>final_df.spend_std_dev</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M460.18,-393.8C460.18,-393.8 312.57,-393.8 312.57,-393.8 306.57,-393.8 300.57,-387.8 300.57,-381.8 300.57,-381.8 300.57,-342.2 300.57,-342.2 300.57,-336.2 306.57,-330.2 312.57,-330.2 312.57,-330.2 460.18,-330.2 460.18,-330.2 466.18,-330.2 472.18,-336.2 472.18,-342.2 472.18,-342.2 472.18,-381.8 472.18,-381.8 472.18,-387.8 466.18,-393.8 460.18,-393.8\"/>\n",
       "<text text-anchor=\"start\" x=\"311.38\" y=\"-370.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_std_dev</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-342.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_std_dev -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_std_dev</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.71,-305.89C255.14,-311.02 267.14,-316.28 278.45,-321 282.2,-322.57 286.04,-324.15 289.92,-325.72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"288.28,-328.84 298.87,-329.33 290.9,-322.35 288.28,-328.84\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>final_df.spend_per_signup</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M471.05,-191.8C471.05,-191.8 301.7,-191.8 301.7,-191.8 295.7,-191.8 289.7,-185.8 289.7,-179.8 289.7,-179.8 289.7,-140.2 289.7,-140.2 289.7,-134.2 295.7,-128.2 301.7,-128.2 301.7,-128.2 471.05,-128.2 471.05,-128.2 477.05,-128.2 483.05,-134.2 483.05,-140.2 483.05,-140.2 483.05,-179.8 483.05,-179.8 483.05,-185.8 477.05,-191.8 471.05,-191.8\"/>\n",
       "<text text-anchor=\"start\" x=\"300.5\" y=\"-168.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_per_signup</text>\n",
       "<text text-anchor=\"start\" x=\"367.25\" y=\"-140.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M222.31,-248.04C238.55,-234 258.67,-218.01 278.45,-206 283.34,-203.03 288.47,-200.15 293.7,-197.38\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.22,-200.54 302.54,-192.89 292.04,-194.3 295.22,-200.54\"/>\n",
       "</g>\n",
       "<!-- final_df.__append -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>final_df.__append</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1183.85,-398.8C1183.85,-398.8 1071.5,-398.8 1071.5,-398.8 1065.5,-398.8 1059.5,-392.8 1059.5,-386.8 1059.5,-386.8 1059.5,-347.2 1059.5,-347.2 1059.5,-341.2 1065.5,-335.2 1071.5,-335.2 1071.5,-335.2 1183.85,-335.2 1183.85,-335.2 1189.85,-335.2 1195.85,-341.2 1195.85,-347.2 1195.85,-347.2 1195.85,-386.8 1195.85,-386.8 1195.85,-392.8 1189.85,-398.8 1183.85,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1070.3\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.__append</text>\n",
       "<text text-anchor=\"start\" x=\"1093.55\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.75,-250.87C254.98,-246.12 266.89,-241.84 278.45,-239 425.34,-202.97 467.29,-210.32 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M703.15,-469.8C703.15,-469.8 535.3,-469.8 535.3,-469.8 529.3,-469.8 523.3,-463.8 523.3,-457.8 523.3,-457.8 523.3,-418.2 523.3,-418.2 523.3,-412.2 529.3,-406.2 535.3,-406.2 535.3,-406.2 703.15,-406.2 703.15,-406.2 709.15,-406.2 715.15,-412.2 715.15,-418.2 715.15,-418.2 715.15,-457.8 715.15,-457.8 715.15,-463.8 709.15,-469.8 703.15,-469.8\"/>\n",
       "<text text-anchor=\"start\" x=\"534.1\" y=\"-446.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean</text>\n",
       "<text text-anchor=\"start\" x=\"600.1\" y=\"-418.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge16\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M191.41,-312.19C198.5,-359.52 219.28,-446.45 278.45,-485 358.34,-537.05 471.23,-505.6 544.57,-474.74\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"545.91,-477.98 553.71,-470.8 543.14,-471.55 545.91,-477.98\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>final_df.spend_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M452.68,-475.8C452.68,-475.8 320.07,-475.8 320.07,-475.8 314.07,-475.8 308.07,-469.8 308.07,-463.8 308.07,-463.8 308.07,-424.2 308.07,-424.2 308.07,-418.2 314.07,-412.2 320.07,-412.2 320.07,-412.2 452.68,-412.2 452.68,-412.2 458.68,-412.2 464.68,-418.2 464.68,-424.2 464.68,-424.2 464.68,-463.8 464.68,-463.8 464.68,-469.8 458.68,-475.8 452.68,-475.8\"/>\n",
       "<text text-anchor=\"start\" x=\"318.88\" y=\"-452.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_mean</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-424.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_mean -->\n",
       "<g id=\"edge18\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M204.56,-312.04C220.31,-339.53 246.29,-378.49 278.45,-403 284.4,-407.53 290.91,-411.62 297.69,-415.29\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.92,-418.32 306.42,-419.7 299.07,-412.07 295.92,-418.32\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend -->\n",
       "<g id=\"node12\" class=\"node\">\n",
       "<title>final_df.avg_3wk_spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M482.3,-311.8C482.3,-311.8 290.45,-311.8 290.45,-311.8 284.45,-311.8 278.45,-305.8 278.45,-299.8 278.45,-299.8 278.45,-260.2 278.45,-260.2 278.45,-254.2 284.45,-248.2 290.45,-248.2 290.45,-248.2 482.3,-248.2 482.3,-248.2 488.3,-248.2 494.3,-254.2 494.3,-260.2 494.3,-260.2 494.3,-299.8 494.3,-299.8 494.3,-305.8 488.3,-311.8 482.3,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"289.25\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.avg_3wk_spend: case</text>\n",
       "<text text-anchor=\"start\" x=\"367.25\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.avg_3wk_spend -->\n",
       "<g id=\"edge19\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.avg_3wk_spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.7,-280C251.06,-280 258.82,-280 266.76,-280\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"266.57,-283.5 276.57,-280 266.57,-276.5 266.57,-283.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1018.5,-398.8C1018.5,-398.8 756.15,-398.8 756.15,-398.8 750.15,-398.8 744.15,-392.8 744.15,-386.8 744.15,-386.8 744.15,-347.2 744.15,-347.2 744.15,-341.2 750.15,-335.2 756.15,-335.2 756.15,-335.2 1018.5,-335.2 1018.5,-335.2 1024.5,-335.2 1030.5,-341.2 1030.5,-347.2 1030.5,-347.2 1030.5,-386.8 1030.5,-386.8 1030.5,-392.8 1024.5,-398.8 1018.5,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"754.95\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean_unit_variance</text>\n",
       "<text text-anchor=\"start\" x=\"868.2\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge14\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1030.76,-367C1036.54,-367 1042.25,-367 1047.83,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.55,-370.5 1057.55,-367 1047.55,-363.5 1047.55,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>final_df</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M1302.7,-398.8C1302.7,-398.8 1236.85,-398.8 1236.85,-398.8 1230.85,-398.8 1224.85,-392.8 1224.85,-386.8 1224.85,-386.8 1224.85,-347.2 1224.85,-347.2 1224.85,-341.2 1230.85,-335.2 1236.85,-335.2 1236.85,-335.2 1302.7,-335.2 1302.7,-335.2 1308.7,-335.2 1314.7,-341.2 1314.7,-347.2 1314.7,-347.2 1314.7,-386.8 1314.7,-386.8 1314.7,-392.8 1308.7,-398.8 1302.7,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1245.78\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df</text>\n",
       "<text text-anchor=\"start\" x=\"1235.65\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M472.58,-362.85C543.7,-363.57 646.89,-364.6 732.42,-365.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"732.28,-368.96 742.31,-365.56 732.35,-361.96 732.28,-368.96\"/>\n",
       "</g>\n",
       "<!-- initial_df -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>initial_df</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M83.35,-131.8C83.35,-131.8 17.5,-131.8 17.5,-131.8 11.5,-131.8 5.5,-125.8 5.5,-119.8 5.5,-119.8 5.5,-80.2 5.5,-80.2 5.5,-74.2 11.5,-68.2 17.5,-68.2 17.5,-68.2 83.35,-68.2 83.35,-68.2 89.35,-68.2 95.35,-74.2 95.35,-80.2 95.35,-80.2 95.35,-119.8 95.35,-119.8 95.35,-125.8 89.35,-131.8 83.35,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"22.67\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">initial_df</text>\n",
       "<text text-anchor=\"start\" x=\"16.3\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.spend -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M89.93,-132.1C91.82,-134.04 93.64,-136.02 95.35,-138 122.03,-168.87 146.53,-208.28 163.3,-237.75\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"160.21,-239.4 168.15,-246.4 166.31,-235.97 160.21,-239.4\"/>\n",
       "</g>\n",
       "<!-- final_df.signups -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>final_df.signups</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M237.45,-131.8C237.45,-131.8 136.35,-131.8 136.35,-131.8 130.35,-131.8 124.35,-125.8 124.35,-119.8 124.35,-119.8 124.35,-80.2 124.35,-80.2 124.35,-74.2 130.35,-68.2 136.35,-68.2 136.35,-68.2 237.45,-68.2 237.45,-68.2 243.45,-68.2 249.45,-74.2 249.45,-80.2 249.45,-80.2 249.45,-119.8 249.45,-119.8 249.45,-125.8 243.45,-131.8 237.45,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"135.15\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.signups</text>\n",
       "<text text-anchor=\"start\" x=\"167.77\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.signups -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.signups</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.83,-100C101.33,-100 107.06,-100 112.85,-100\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"112.5,-103.5 122.5,-100 112.5,-96.5 112.5,-103.5\"/>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge15\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M620.23,-220C776.95,-229.59 950.98,-292.31 1048.79,-332.66\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.2,-335.79 1057.78,-336.4 1049.89,-329.33 1047.2,-335.79\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M387.38,-100C433.3,-114.84 450.42,-98.89 494.3,-119 558.89,-148.61 548.22,-207.83 618.23,-220\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.79,-70.39C104.89,-65.69 114.66,-61.54 124.35,-59 237.95,-29.25 273.63,-63.89 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge12\" class=\"edge\">\n",
       "<title>final_df.spend_per_signup&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M478.73,-192.28C520.63,-204.86 571.32,-216.99 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.84,-118.82C258.96,-121.59 268.57,-124.51 278.29,-127.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"277.26,-130.81 287.85,-130.37 279.29,-124.11 277.26,-130.81\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.92,-90.37C289.6,-86.54 341.66,-85.87 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.__append&#45;&gt;final_df -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>final_df.__append&#45;&gt;final_df</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1196.26,-367C1202,-367 1207.75,-367 1213.38,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1213.17,-370.5 1223.17,-367 1213.17,-363.5 1213.17,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.54,-412.57C728.24,-409.18 741.44,-405.66 754.62,-402.14\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"755.46,-405.54 764.22,-399.58 753.65,-398.78 755.46,-405.54\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge13\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.28,-439.84C799.32,-439.41 924.66,-433.68 1030.5,-408 1036.4,-406.57 1042.4,-404.81 1048.37,-402.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1049.36,-406.2 1057.63,-399.58 1047.04,-399.6 1049.36,-406.2\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge17\" class=\"edge\">\n",
       "<title>final_df.spend_mean&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M464.89,-441.99C479.85,-441.6 495.78,-441.18 511.49,-440.77\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"511.45,-444.28 521.36,-440.52 511.27,-437.28 511.45,-444.28\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>final_df.avg_3wk_spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M462.35,-247.73C506.94,-231.78 565.02,-216.59 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- config -->\n",
       "<g id=\"node13\" class=\"node\">\n",
       "<title>config</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"71.42,-186 23.42,-186 23.42,-150 77.42,-150 77.42,-180 71.42,-186\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"71.42,-186 71.42,-180\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"77.42,-180 71.42,-180\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-162.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">config</text>\n",
       "</g>\n",
       "<!-- function -->\n",
       "<g id=\"node14\" class=\"node\">\n",
       "<title>function</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-240.3C72.85,-240.3 28,-240.3 28,-240.3 22,-240.3 16,-234.3 16,-228.3 16,-228.3 16,-215.7 16,-215.7 16,-209.7 22,-203.7 28,-203.7 28,-203.7 72.85,-203.7 72.85,-203.7 78.85,-203.7 84.85,-209.7 84.85,-215.7 84.85,-215.7 84.85,-228.3 84.85,-228.3 84.85,-234.3 78.85,-240.3 72.85,-240.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-216.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
       "</g>\n",
       "<!-- output -->\n",
       "<g id=\"node15\" class=\"node\">\n",
       "<title>output</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M67.97,-295.3C67.97,-295.3 32.87,-295.3 32.87,-295.3 26.87,-295.3 20.87,-289.3 20.87,-283.3 20.87,-283.3 20.87,-270.7 20.87,-270.7 20.87,-264.7 26.87,-258.7 32.87,-258.7 32.87,-258.7 67.97,-258.7 67.97,-258.7 73.97,-258.7 79.97,-264.7 79.97,-270.7 79.97,-270.7 79.97,-283.3 79.97,-283.3 79.97,-289.3 73.97,-295.3 67.97,-295.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-271.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.graphs.Digraph at 0x7f85ca94ea10>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%cell_to_module with_columns_example --builder my_builder --display --execute output_node\n",
    "import polars as pl\n",
    "from hamilton.plugins.h_polars import with_columns\n",
    "import my_functions\n",
    "\n",
    "output_columns = [\n",
    "    \"spend\",\n",
    "    \"signups\",\n",
    "    \"avg_3wk_spend\",\n",
    "    \"spend_per_signup\",\n",
    "    \"spend_zero_mean_unit_variance\",\n",
    "]\n",
    "\n",
    "def initial_df()->pl.DataFrame:\n",
    "    return pl.DataFrame(\n",
    "        { \n",
    "            \"signups\": pl.Series([1, 10, 50, 100, 200, 400]),\n",
    "            \"spend\": pl.Series([10, 10, 20, 40, 40, 50])*1e6,\n",
    "            }\n",
    "            )\n",
    "\n",
    "# the with_columns call\n",
    "@with_columns(\n",
    "    *[my_functions],\n",
    "    columns_to_pass=[\"spend\", \"signups\"], # The columns to select from the dataframe\n",
    "    # select=output_columns, # The columns to append to the dataframe\n",
    "    # config_required = [\"a\"]\n",
    ")\n",
    "def final_df(initial_df: pl.DataFrame) -> pl.DataFrame:\n",
    "    return initial_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "shape: (6, 6)\n",
      "┌─────────┬───────┬───────────────┬──────────────────┬─────────────────┬───────────────────────────┐\n",
      "│ signups ┆ spend ┆ avg_3wk_spend ┆ spend_per_signup ┆ spend_zero_mean ┆ spend_zero_mean_unit_vari │\n",
      "│ ---     ┆ ---   ┆ ---           ┆ ---              ┆ ---             ┆ ance                      │\n",
      "│ i64     ┆ f64   ┆ f64           ┆ f64              ┆ f64             ┆ ---                       │\n",
      "│         ┆       ┆               ┆                  ┆                 ┆ f64                       │\n",
      "╞═════════╪═══════╪═══════════════╪══════════════════╪═════════════════╪═══════════════════════════╡\n",
      "│ 1       ┆ 1e7   ┆ null          ┆ 1e7              ┆ -1.8333e7       ┆ -1.064405                 │\n",
      "│ 10      ┆ 1e7   ┆ null          ┆ 1e6              ┆ -1.8333e7       ┆ -1.064405                 │\n",
      "│ 50      ┆ 2e7   ┆ 13.333333     ┆ 400000.0         ┆ -8.3333e6       ┆ -0.483821                 │\n",
      "│ 100     ┆ 4e7   ┆ 23.333333     ┆ 400000.0         ┆ 1.1667e7        ┆ 0.677349                  │\n",
      "│ 200     ┆ 4e7   ┆ 33.333333     ┆ 200000.0         ┆ 1.1667e7        ┆ 0.677349                  │\n",
      "│ 400     ┆ 5e7   ┆ 43.333333     ┆ 125000.0         ┆ 2.1667e7        ┆ 1.257934                  │\n",
      "└─────────┴───────┴───────────────┴──────────────────┴─────────────────┴───────────────────────────┘\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 12.1.2 (20240928.0832)\n",
       " -->\n",
       "<!-- Pages: 1 -->\n",
       "<svg width=\"1323pt\" height=\"521pt\"\n",
       " viewBox=\"0.00 0.00 1322.70 520.92\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 516.92)\">\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-516.92 1318.7,-516.92 1318.7,4 -4,4\"/>\n",
       "<g id=\"clust1\" class=\"cluster\">\n",
       "<title>cluster__legend</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"8,-142 8,-326 92.85,-326 92.85,-142 8,-142\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-308.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
       "</g>\n",
       "<!-- case -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>case</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"75.3,-50 19.55,-50 19.55,0 81.3,0 81.3,-44 75.3,-50\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"75.3,-50 75.3,-44\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"81.3,-44 75.3,-44\"/>\n",
       "<text text-anchor=\"start\" x=\"35.42\" y=\"-33.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">case</text>\n",
       "<text text-anchor=\"start\" x=\"27.55\" y=\"-5.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">millions</text>\n",
       "</g>\n",
       "<!-- final_df.spend -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>final_df.spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M231.45,-311.8C231.45,-311.8 142.35,-311.8 142.35,-311.8 136.35,-311.8 130.35,-305.8 130.35,-299.8 130.35,-299.8 130.35,-260.2 130.35,-260.2 130.35,-254.2 136.35,-248.2 142.35,-248.2 142.35,-248.2 231.45,-248.2 231.45,-248.2 237.45,-248.2 243.45,-254.2 243.45,-260.2 243.45,-260.2 243.45,-299.8 243.45,-299.8 243.45,-305.8 237.45,-311.8 231.45,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"141.15\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend</text>\n",
       "<text text-anchor=\"start\" x=\"167.77\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>final_df.spend_std_dev</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M460.18,-393.8C460.18,-393.8 312.57,-393.8 312.57,-393.8 306.57,-393.8 300.57,-387.8 300.57,-381.8 300.57,-381.8 300.57,-342.2 300.57,-342.2 300.57,-336.2 306.57,-330.2 312.57,-330.2 312.57,-330.2 460.18,-330.2 460.18,-330.2 466.18,-330.2 472.18,-336.2 472.18,-342.2 472.18,-342.2 472.18,-381.8 472.18,-381.8 472.18,-387.8 466.18,-393.8 460.18,-393.8\"/>\n",
       "<text text-anchor=\"start\" x=\"311.38\" y=\"-370.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_std_dev</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-342.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_std_dev -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_std_dev</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.71,-305.89C255.14,-311.02 267.14,-316.28 278.45,-321 282.2,-322.57 286.04,-324.15 289.92,-325.72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"288.28,-328.84 298.87,-329.33 290.9,-322.35 288.28,-328.84\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>final_df.spend_per_signup</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M471.05,-191.8C471.05,-191.8 301.7,-191.8 301.7,-191.8 295.7,-191.8 289.7,-185.8 289.7,-179.8 289.7,-179.8 289.7,-140.2 289.7,-140.2 289.7,-134.2 295.7,-128.2 301.7,-128.2 301.7,-128.2 471.05,-128.2 471.05,-128.2 477.05,-128.2 483.05,-134.2 483.05,-140.2 483.05,-140.2 483.05,-179.8 483.05,-179.8 483.05,-185.8 477.05,-191.8 471.05,-191.8\"/>\n",
       "<text text-anchor=\"start\" x=\"300.5\" y=\"-168.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_per_signup</text>\n",
       "<text text-anchor=\"start\" x=\"367.25\" y=\"-140.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M222.31,-248.04C238.55,-234 258.67,-218.01 278.45,-206 283.34,-203.03 288.47,-200.15 293.7,-197.38\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.22,-200.54 302.54,-192.89 292.04,-194.3 295.22,-200.54\"/>\n",
       "</g>\n",
       "<!-- final_df.__append -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>final_df.__append</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1183.85,-398.8C1183.85,-398.8 1071.5,-398.8 1071.5,-398.8 1065.5,-398.8 1059.5,-392.8 1059.5,-386.8 1059.5,-386.8 1059.5,-347.2 1059.5,-347.2 1059.5,-341.2 1065.5,-335.2 1071.5,-335.2 1071.5,-335.2 1183.85,-335.2 1183.85,-335.2 1189.85,-335.2 1195.85,-341.2 1195.85,-347.2 1195.85,-347.2 1195.85,-386.8 1195.85,-386.8 1195.85,-392.8 1189.85,-398.8 1183.85,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1070.3\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.__append</text>\n",
       "<text text-anchor=\"start\" x=\"1093.55\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.75,-250.87C254.98,-246.12 266.89,-241.84 278.45,-239 425.34,-202.97 467.29,-210.32 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M703.15,-469.8C703.15,-469.8 535.3,-469.8 535.3,-469.8 529.3,-469.8 523.3,-463.8 523.3,-457.8 523.3,-457.8 523.3,-418.2 523.3,-418.2 523.3,-412.2 529.3,-406.2 535.3,-406.2 535.3,-406.2 703.15,-406.2 703.15,-406.2 709.15,-406.2 715.15,-412.2 715.15,-418.2 715.15,-418.2 715.15,-457.8 715.15,-457.8 715.15,-463.8 709.15,-469.8 703.15,-469.8\"/>\n",
       "<text text-anchor=\"start\" x=\"534.1\" y=\"-446.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean</text>\n",
       "<text text-anchor=\"start\" x=\"600.1\" y=\"-418.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge16\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M191.41,-312.19C198.5,-359.52 219.28,-446.45 278.45,-485 358.34,-537.05 471.23,-505.6 544.57,-474.74\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"545.91,-477.98 553.71,-470.8 543.14,-471.55 545.91,-477.98\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>final_df.spend_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M452.68,-475.8C452.68,-475.8 320.07,-475.8 320.07,-475.8 314.07,-475.8 308.07,-469.8 308.07,-463.8 308.07,-463.8 308.07,-424.2 308.07,-424.2 308.07,-418.2 314.07,-412.2 320.07,-412.2 320.07,-412.2 452.68,-412.2 452.68,-412.2 458.68,-412.2 464.68,-418.2 464.68,-424.2 464.68,-424.2 464.68,-463.8 464.68,-463.8 464.68,-469.8 458.68,-475.8 452.68,-475.8\"/>\n",
       "<text text-anchor=\"start\" x=\"318.88\" y=\"-452.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_mean</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-424.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_mean -->\n",
       "<g id=\"edge18\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M204.56,-312.04C220.31,-339.53 246.29,-378.49 278.45,-403 284.4,-407.53 290.91,-411.62 297.69,-415.29\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.92,-418.32 306.42,-419.7 299.07,-412.07 295.92,-418.32\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend -->\n",
       "<g id=\"node12\" class=\"node\">\n",
       "<title>final_df.avg_3wk_spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M482.3,-311.8C482.3,-311.8 290.45,-311.8 290.45,-311.8 284.45,-311.8 278.45,-305.8 278.45,-299.8 278.45,-299.8 278.45,-260.2 278.45,-260.2 278.45,-254.2 284.45,-248.2 290.45,-248.2 290.45,-248.2 482.3,-248.2 482.3,-248.2 488.3,-248.2 494.3,-254.2 494.3,-260.2 494.3,-260.2 494.3,-299.8 494.3,-299.8 494.3,-305.8 488.3,-311.8 482.3,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"289.25\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.avg_3wk_spend: case</text>\n",
       "<text text-anchor=\"start\" x=\"367.25\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.avg_3wk_spend -->\n",
       "<g id=\"edge19\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.avg_3wk_spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.7,-280C251.06,-280 258.82,-280 266.76,-280\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"266.57,-283.5 276.57,-280 266.57,-276.5 266.57,-283.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1018.5,-398.8C1018.5,-398.8 756.15,-398.8 756.15,-398.8 750.15,-398.8 744.15,-392.8 744.15,-386.8 744.15,-386.8 744.15,-347.2 744.15,-347.2 744.15,-341.2 750.15,-335.2 756.15,-335.2 756.15,-335.2 1018.5,-335.2 1018.5,-335.2 1024.5,-335.2 1030.5,-341.2 1030.5,-347.2 1030.5,-347.2 1030.5,-386.8 1030.5,-386.8 1030.5,-392.8 1024.5,-398.8 1018.5,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"754.95\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean_unit_variance</text>\n",
       "<text text-anchor=\"start\" x=\"868.2\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge14\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1030.76,-367C1036.54,-367 1042.25,-367 1047.83,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.55,-370.5 1057.55,-367 1047.55,-363.5 1047.55,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>final_df</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M1302.7,-398.8C1302.7,-398.8 1236.85,-398.8 1236.85,-398.8 1230.85,-398.8 1224.85,-392.8 1224.85,-386.8 1224.85,-386.8 1224.85,-347.2 1224.85,-347.2 1224.85,-341.2 1230.85,-335.2 1236.85,-335.2 1236.85,-335.2 1302.7,-335.2 1302.7,-335.2 1308.7,-335.2 1314.7,-341.2 1314.7,-347.2 1314.7,-347.2 1314.7,-386.8 1314.7,-386.8 1314.7,-392.8 1308.7,-398.8 1302.7,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1245.78\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df</text>\n",
       "<text text-anchor=\"start\" x=\"1235.65\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M472.58,-362.85C543.7,-363.57 646.89,-364.6 732.42,-365.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"732.28,-368.96 742.31,-365.56 732.35,-361.96 732.28,-368.96\"/>\n",
       "</g>\n",
       "<!-- initial_df -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>initial_df</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M83.35,-131.8C83.35,-131.8 17.5,-131.8 17.5,-131.8 11.5,-131.8 5.5,-125.8 5.5,-119.8 5.5,-119.8 5.5,-80.2 5.5,-80.2 5.5,-74.2 11.5,-68.2 17.5,-68.2 17.5,-68.2 83.35,-68.2 83.35,-68.2 89.35,-68.2 95.35,-74.2 95.35,-80.2 95.35,-80.2 95.35,-119.8 95.35,-119.8 95.35,-125.8 89.35,-131.8 83.35,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"22.67\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">initial_df</text>\n",
       "<text text-anchor=\"start\" x=\"16.3\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">DataFrame</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.spend -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M89.93,-132.1C91.82,-134.04 93.64,-136.02 95.35,-138 122.03,-168.87 146.53,-208.28 163.3,-237.75\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"160.21,-239.4 168.15,-246.4 166.31,-235.97 160.21,-239.4\"/>\n",
       "</g>\n",
       "<!-- final_df.signups -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>final_df.signups</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M237.45,-131.8C237.45,-131.8 136.35,-131.8 136.35,-131.8 130.35,-131.8 124.35,-125.8 124.35,-119.8 124.35,-119.8 124.35,-80.2 124.35,-80.2 124.35,-74.2 130.35,-68.2 136.35,-68.2 136.35,-68.2 237.45,-68.2 237.45,-68.2 243.45,-68.2 249.45,-74.2 249.45,-80.2 249.45,-80.2 249.45,-119.8 249.45,-119.8 249.45,-125.8 243.45,-131.8 237.45,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"135.15\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.signups</text>\n",
       "<text text-anchor=\"start\" x=\"167.77\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.signups -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.signups</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.83,-100C101.33,-100 107.06,-100 112.85,-100\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"112.5,-103.5 122.5,-100 112.5,-96.5 112.5,-103.5\"/>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge15\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M620.23,-220C776.95,-229.59 950.98,-292.31 1048.79,-332.66\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.2,-335.79 1057.78,-336.4 1049.89,-329.33 1047.2,-335.79\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M387.38,-100C433.3,-114.84 450.42,-98.89 494.3,-119 558.89,-148.61 548.22,-207.83 618.23,-220\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.79,-70.39C104.89,-65.69 114.66,-61.54 124.35,-59 237.95,-29.25 273.63,-63.89 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge12\" class=\"edge\">\n",
       "<title>final_df.spend_per_signup&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M478.73,-192.28C520.63,-204.86 571.32,-216.99 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.84,-118.82C258.96,-121.59 268.57,-124.51 278.29,-127.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"277.26,-130.81 287.85,-130.37 279.29,-124.11 277.26,-130.81\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.92,-90.37C289.6,-86.54 341.66,-85.87 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.__append&#45;&gt;final_df -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>final_df.__append&#45;&gt;final_df</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1196.26,-367C1202,-367 1207.75,-367 1213.38,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1213.17,-370.5 1223.17,-367 1213.17,-363.5 1213.17,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.54,-412.57C728.24,-409.18 741.44,-405.66 754.62,-402.14\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"755.46,-405.54 764.22,-399.58 753.65,-398.78 755.46,-405.54\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge13\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.28,-439.84C799.32,-439.41 924.66,-433.68 1030.5,-408 1036.4,-406.57 1042.4,-404.81 1048.37,-402.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1049.36,-406.2 1057.63,-399.58 1047.04,-399.6 1049.36,-406.2\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge17\" class=\"edge\">\n",
       "<title>final_df.spend_mean&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M464.89,-441.99C479.85,-441.6 495.78,-441.18 511.49,-440.77\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"511.45,-444.28 521.36,-440.52 511.27,-437.28 511.45,-444.28\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>final_df.avg_3wk_spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M462.35,-247.73C506.94,-231.78 565.02,-216.59 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- config -->\n",
       "<g id=\"node13\" class=\"node\">\n",
       "<title>config</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"71.42,-186 23.42,-186 23.42,-150 77.42,-150 77.42,-180 71.42,-186\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"71.42,-186 71.42,-180\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"77.42,-180 71.42,-180\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-162.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">config</text>\n",
       "</g>\n",
       "<!-- function -->\n",
       "<g id=\"node14\" class=\"node\">\n",
       "<title>function</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-240.3C72.85,-240.3 28,-240.3 28,-240.3 22,-240.3 16,-234.3 16,-228.3 16,-228.3 16,-215.7 16,-215.7 16,-209.7 22,-203.7 28,-203.7 28,-203.7 72.85,-203.7 72.85,-203.7 78.85,-203.7 84.85,-209.7 84.85,-215.7 84.85,-215.7 84.85,-228.3 84.85,-228.3 84.85,-234.3 78.85,-240.3 72.85,-240.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-216.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
       "</g>\n",
       "<!-- output -->\n",
       "<g id=\"node15\" class=\"node\">\n",
       "<title>output</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M67.97,-295.3C67.97,-295.3 32.87,-295.3 32.87,-295.3 26.87,-295.3 20.87,-289.3 20.87,-283.3 20.87,-283.3 20.87,-270.7 20.87,-270.7 20.87,-264.7 26.87,-258.7 32.87,-258.7 32.87,-258.7 67.97,-258.7 67.97,-258.7 73.97,-258.7 79.97,-264.7 79.97,-270.7 79.97,-270.7 79.97,-283.3 79.97,-283.3 79.97,-289.3 73.97,-295.3 67.97,-295.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-271.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.graphs.Digraph at 0x7f85ca94c0d0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import with_columns_example\n",
    "dr = driver.Builder().with_modules(my_functions, with_columns_example).with_config({\"case\":\"millions\"}).build()\n",
    "print(dr.execute(final_vars=[\"final_df\"])[\"final_df\"])\n",
    "dr.visualize_execution(final_vars=[\"final_df\"])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example of using with_columns for Polars LazyFrame\n",
    "\n",
    "This allows you to efficiently run groups of map operations on a dataframe.\n",
    "Here's an example of calling it -- if you've seen `@subdag`, you should be familiar with the concepts."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "%reload_ext hamilton.plugins.jupyter_magic\n",
    "from hamilton import driver\n",
    "import my_functions_lazy\n",
    "\n",
    "my_builder_lazy = driver.Builder().with_modules(my_functions_lazy).with_config({\"case\":\"thousands\"})\n",
    "output_node = [\"final_df\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 12.1.2 (20240928.0832)\n",
       " -->\n",
       "<!-- Pages: 1 -->\n",
       "<svg width=\"1323pt\" height=\"521pt\"\n",
       " viewBox=\"0.00 0.00 1322.70 520.92\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 516.92)\">\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-516.92 1318.7,-516.92 1318.7,4 -4,4\"/>\n",
       "<g id=\"clust1\" class=\"cluster\">\n",
       "<title>cluster__legend</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"8,-142 8,-326 92.85,-326 92.85,-142 8,-142\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-308.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
       "</g>\n",
       "<!-- case -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>case</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"83.55,-50 11.3,-50 11.3,0 89.55,0 89.55,-44 83.55,-50\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"83.55,-50 83.55,-44\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"89.55,-44 83.55,-44\"/>\n",
       "<text text-anchor=\"start\" x=\"35.42\" y=\"-33.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">case</text>\n",
       "<text text-anchor=\"start\" x=\"19.3\" y=\"-5.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">thousands</text>\n",
       "</g>\n",
       "<!-- final_df.spend -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>final_df.spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M231.45,-311.8C231.45,-311.8 142.35,-311.8 142.35,-311.8 136.35,-311.8 130.35,-305.8 130.35,-299.8 130.35,-299.8 130.35,-260.2 130.35,-260.2 130.35,-254.2 136.35,-248.2 142.35,-248.2 142.35,-248.2 231.45,-248.2 231.45,-248.2 237.45,-248.2 243.45,-254.2 243.45,-260.2 243.45,-260.2 243.45,-299.8 243.45,-299.8 243.45,-305.8 237.45,-311.8 231.45,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"141.15\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend</text>\n",
       "<text text-anchor=\"start\" x=\"173.02\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>final_df.spend_std_dev</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M460.18,-393.8C460.18,-393.8 312.57,-393.8 312.57,-393.8 306.57,-393.8 300.57,-387.8 300.57,-381.8 300.57,-381.8 300.57,-342.2 300.57,-342.2 300.57,-336.2 306.57,-330.2 312.57,-330.2 312.57,-330.2 460.18,-330.2 460.18,-330.2 466.18,-330.2 472.18,-336.2 472.18,-342.2 472.18,-342.2 472.18,-381.8 472.18,-381.8 472.18,-387.8 466.18,-393.8 460.18,-393.8\"/>\n",
       "<text text-anchor=\"start\" x=\"311.38\" y=\"-370.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_std_dev</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-342.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_std_dev -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_std_dev</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.71,-305.89C255.14,-311.02 267.14,-316.28 278.45,-321 282.2,-322.57 286.04,-324.15 289.92,-325.72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"288.28,-328.84 298.87,-329.33 290.9,-322.35 288.28,-328.84\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>final_df.spend_per_signup</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M471.05,-191.8C471.05,-191.8 301.7,-191.8 301.7,-191.8 295.7,-191.8 289.7,-185.8 289.7,-179.8 289.7,-179.8 289.7,-140.2 289.7,-140.2 289.7,-134.2 295.7,-128.2 301.7,-128.2 301.7,-128.2 471.05,-128.2 471.05,-128.2 477.05,-128.2 483.05,-134.2 483.05,-140.2 483.05,-140.2 483.05,-179.8 483.05,-179.8 483.05,-185.8 477.05,-191.8 471.05,-191.8\"/>\n",
       "<text text-anchor=\"start\" x=\"300.5\" y=\"-168.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_per_signup</text>\n",
       "<text text-anchor=\"start\" x=\"372.5\" y=\"-140.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M222.31,-248.04C238.55,-234 258.67,-218.01 278.45,-206 283.34,-203.03 288.47,-200.15 293.7,-197.38\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.22,-200.54 302.54,-192.89 292.04,-194.3 295.22,-200.54\"/>\n",
       "</g>\n",
       "<!-- final_df.__append -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>final_df.__append</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1183.85,-398.8C1183.85,-398.8 1071.5,-398.8 1071.5,-398.8 1065.5,-398.8 1059.5,-392.8 1059.5,-386.8 1059.5,-386.8 1059.5,-347.2 1059.5,-347.2 1059.5,-341.2 1065.5,-335.2 1071.5,-335.2 1071.5,-335.2 1183.85,-335.2 1183.85,-335.2 1189.85,-335.2 1195.85,-341.2 1195.85,-347.2 1195.85,-347.2 1195.85,-386.8 1195.85,-386.8 1195.85,-392.8 1189.85,-398.8 1183.85,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1070.3\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.__append</text>\n",
       "<text text-anchor=\"start\" x=\"1093.55\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">LazyFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.75,-250.87C254.98,-246.12 266.89,-241.84 278.45,-239 425.34,-202.97 467.29,-210.32 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M703.15,-469.8C703.15,-469.8 535.3,-469.8 535.3,-469.8 529.3,-469.8 523.3,-463.8 523.3,-457.8 523.3,-457.8 523.3,-418.2 523.3,-418.2 523.3,-412.2 529.3,-406.2 535.3,-406.2 535.3,-406.2 703.15,-406.2 703.15,-406.2 709.15,-406.2 715.15,-412.2 715.15,-418.2 715.15,-418.2 715.15,-457.8 715.15,-457.8 715.15,-463.8 709.15,-469.8 703.15,-469.8\"/>\n",
       "<text text-anchor=\"start\" x=\"534.1\" y=\"-446.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean</text>\n",
       "<text text-anchor=\"start\" x=\"605.35\" y=\"-418.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge16\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M191.41,-312.19C198.5,-359.52 219.28,-446.45 278.45,-485 358.34,-537.05 471.23,-505.6 544.57,-474.74\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"545.91,-477.98 553.71,-470.8 543.14,-471.55 545.91,-477.98\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>final_df.spend_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M452.68,-475.8C452.68,-475.8 320.07,-475.8 320.07,-475.8 314.07,-475.8 308.07,-469.8 308.07,-463.8 308.07,-463.8 308.07,-424.2 308.07,-424.2 308.07,-418.2 314.07,-412.2 320.07,-412.2 320.07,-412.2 452.68,-412.2 452.68,-412.2 458.68,-412.2 464.68,-418.2 464.68,-424.2 464.68,-424.2 464.68,-463.8 464.68,-463.8 464.68,-469.8 458.68,-475.8 452.68,-475.8\"/>\n",
       "<text text-anchor=\"start\" x=\"318.88\" y=\"-452.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_mean</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-424.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_mean -->\n",
       "<g id=\"edge18\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M204.56,-312.04C220.31,-339.53 246.29,-378.49 278.45,-403 284.4,-407.53 290.91,-411.62 297.69,-415.29\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.92,-418.32 306.42,-419.7 299.07,-412.07 295.92,-418.32\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend -->\n",
       "<g id=\"node12\" class=\"node\">\n",
       "<title>final_df.avg_3wk_spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M482.3,-311.8C482.3,-311.8 290.45,-311.8 290.45,-311.8 284.45,-311.8 278.45,-305.8 278.45,-299.8 278.45,-299.8 278.45,-260.2 278.45,-260.2 278.45,-254.2 284.45,-248.2 290.45,-248.2 290.45,-248.2 482.3,-248.2 482.3,-248.2 488.3,-248.2 494.3,-254.2 494.3,-260.2 494.3,-260.2 494.3,-299.8 494.3,-299.8 494.3,-305.8 488.3,-311.8 482.3,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"289.25\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.avg_3wk_spend: case</text>\n",
       "<text text-anchor=\"start\" x=\"372.5\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.avg_3wk_spend -->\n",
       "<g id=\"edge19\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.avg_3wk_spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.7,-280C251.06,-280 258.82,-280 266.76,-280\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"266.57,-283.5 276.57,-280 266.57,-276.5 266.57,-283.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1018.5,-398.8C1018.5,-398.8 756.15,-398.8 756.15,-398.8 750.15,-398.8 744.15,-392.8 744.15,-386.8 744.15,-386.8 744.15,-347.2 744.15,-347.2 744.15,-341.2 750.15,-335.2 756.15,-335.2 756.15,-335.2 1018.5,-335.2 1018.5,-335.2 1024.5,-335.2 1030.5,-341.2 1030.5,-347.2 1030.5,-347.2 1030.5,-386.8 1030.5,-386.8 1030.5,-392.8 1024.5,-398.8 1018.5,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"754.95\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean_unit_variance</text>\n",
       "<text text-anchor=\"start\" x=\"873.45\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge14\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1030.76,-367C1036.54,-367 1042.25,-367 1047.83,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.55,-370.5 1057.55,-367 1047.55,-363.5 1047.55,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>final_df</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M1302.7,-398.8C1302.7,-398.8 1236.85,-398.8 1236.85,-398.8 1230.85,-398.8 1224.85,-392.8 1224.85,-386.8 1224.85,-386.8 1224.85,-347.2 1224.85,-347.2 1224.85,-341.2 1230.85,-335.2 1236.85,-335.2 1236.85,-335.2 1302.7,-335.2 1302.7,-335.2 1308.7,-335.2 1314.7,-341.2 1314.7,-347.2 1314.7,-347.2 1314.7,-386.8 1314.7,-386.8 1314.7,-392.8 1308.7,-398.8 1302.7,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1245.78\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df</text>\n",
       "<text text-anchor=\"start\" x=\"1235.65\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">LazyFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M472.58,-362.85C543.7,-363.57 646.89,-364.6 732.42,-365.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"732.28,-368.96 742.31,-365.56 732.35,-361.96 732.28,-368.96\"/>\n",
       "</g>\n",
       "<!-- initial_df -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>initial_df</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M83.35,-131.8C83.35,-131.8 17.5,-131.8 17.5,-131.8 11.5,-131.8 5.5,-125.8 5.5,-119.8 5.5,-119.8 5.5,-80.2 5.5,-80.2 5.5,-74.2 11.5,-68.2 17.5,-68.2 17.5,-68.2 83.35,-68.2 83.35,-68.2 89.35,-68.2 95.35,-74.2 95.35,-80.2 95.35,-80.2 95.35,-119.8 95.35,-119.8 95.35,-125.8 89.35,-131.8 83.35,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"22.67\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">initial_df</text>\n",
       "<text text-anchor=\"start\" x=\"16.3\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">LazyFrame</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.spend -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M89.93,-132.1C91.82,-134.04 93.64,-136.02 95.35,-138 122.03,-168.87 146.53,-208.28 163.3,-237.75\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"160.21,-239.4 168.15,-246.4 166.31,-235.97 160.21,-239.4\"/>\n",
       "</g>\n",
       "<!-- final_df.signups -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>final_df.signups</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M237.45,-131.8C237.45,-131.8 136.35,-131.8 136.35,-131.8 130.35,-131.8 124.35,-125.8 124.35,-119.8 124.35,-119.8 124.35,-80.2 124.35,-80.2 124.35,-74.2 130.35,-68.2 136.35,-68.2 136.35,-68.2 237.45,-68.2 237.45,-68.2 243.45,-68.2 249.45,-74.2 249.45,-80.2 249.45,-80.2 249.45,-119.8 249.45,-119.8 249.45,-125.8 243.45,-131.8 237.45,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"135.15\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.signups</text>\n",
       "<text text-anchor=\"start\" x=\"173.02\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.signups -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.signups</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.83,-100C101.33,-100 107.06,-100 112.85,-100\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"112.5,-103.5 122.5,-100 112.5,-96.5 112.5,-103.5\"/>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge15\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M620.23,-220C776.95,-229.59 950.98,-292.31 1048.79,-332.66\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.2,-335.79 1057.78,-336.4 1049.89,-329.33 1047.2,-335.79\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M387.38,-100C433.3,-114.84 450.42,-98.89 494.3,-119 558.89,-148.61 548.22,-207.83 618.23,-220\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.79,-70.39C104.89,-65.69 114.66,-61.54 124.35,-59 237.95,-29.25 273.63,-63.89 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge12\" class=\"edge\">\n",
       "<title>final_df.spend_per_signup&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M478.73,-192.28C520.63,-204.86 571.32,-216.99 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.84,-118.82C258.96,-121.59 268.57,-124.51 278.29,-127.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"277.26,-130.81 287.85,-130.37 279.29,-124.11 277.26,-130.81\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.92,-90.37C289.6,-86.54 341.66,-85.87 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.__append&#45;&gt;final_df -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>final_df.__append&#45;&gt;final_df</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1196.26,-367C1202,-367 1207.75,-367 1213.38,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1213.17,-370.5 1223.17,-367 1213.17,-363.5 1213.17,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.54,-412.57C728.24,-409.18 741.44,-405.66 754.62,-402.14\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"755.46,-405.54 764.22,-399.58 753.65,-398.78 755.46,-405.54\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge13\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.28,-439.84C799.32,-439.41 924.66,-433.68 1030.5,-408 1036.4,-406.57 1042.4,-404.81 1048.37,-402.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1049.36,-406.2 1057.63,-399.58 1047.04,-399.6 1049.36,-406.2\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge17\" class=\"edge\">\n",
       "<title>final_df.spend_mean&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M464.89,-441.99C479.85,-441.6 495.78,-441.18 511.49,-440.77\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"511.45,-444.28 521.36,-440.52 511.27,-437.28 511.45,-444.28\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>final_df.avg_3wk_spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M462.35,-247.73C506.94,-231.78 565.02,-216.59 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- config -->\n",
       "<g id=\"node13\" class=\"node\">\n",
       "<title>config</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"71.42,-186 23.42,-186 23.42,-150 77.42,-150 77.42,-180 71.42,-186\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"71.42,-186 71.42,-180\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"77.42,-180 71.42,-180\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-162.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">config</text>\n",
       "</g>\n",
       "<!-- function -->\n",
       "<g id=\"node14\" class=\"node\">\n",
       "<title>function</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-240.3C72.85,-240.3 28,-240.3 28,-240.3 22,-240.3 16,-234.3 16,-228.3 16,-228.3 16,-215.7 16,-215.7 16,-209.7 22,-203.7 28,-203.7 28,-203.7 72.85,-203.7 72.85,-203.7 78.85,-203.7 84.85,-209.7 84.85,-215.7 84.85,-215.7 84.85,-228.3 84.85,-228.3 84.85,-234.3 78.85,-240.3 72.85,-240.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-216.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
       "</g>\n",
       "<!-- output -->\n",
       "<g id=\"node15\" class=\"node\">\n",
       "<title>output</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M67.97,-295.3C67.97,-295.3 32.87,-295.3 32.87,-295.3 26.87,-295.3 20.87,-289.3 20.87,-283.3 20.87,-283.3 20.87,-270.7 20.87,-270.7 20.87,-264.7 26.87,-258.7 32.87,-258.7 32.87,-258.7 67.97,-258.7 67.97,-258.7 73.97,-258.7 79.97,-264.7 79.97,-270.7 79.97,-270.7 79.97,-283.3 79.97,-283.3 79.97,-289.3 73.97,-295.3 67.97,-295.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-271.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.graphs.Digraph at 0x7f85ca923cd0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%cell_to_module with_columns_lazy_example --builder my_builder_lazy --display --execute output_node\n",
    "import polars as pl\n",
    "from hamilton.plugins.h_polars_lazyframe import with_columns\n",
    "import my_functions_lazy\n",
    "\n",
    "output_columns = [\n",
    "    \"spend\",\n",
    "    \"signups\",\n",
    "    \"avg_3wk_spend\",\n",
    "    \"spend_per_signup\",\n",
    "    \"spend_zero_mean_unit_variance\",\n",
    "]\n",
    "\n",
    "def initial_df()->pl.LazyFrame:\n",
    "    return pl.DataFrame(\n",
    "        { \n",
    "            \"signups\": pl.Series([1, 10, 50, 100, 200, 400]),\n",
    "            \"spend\": pl.Series([10, 10, 20, 40, 40, 50])*1e6,\n",
    "            }\n",
    "            ).lazy()\n",
    "\n",
    "# the with_columns call\n",
    "@with_columns(\n",
    "    *[my_functions_lazy],\n",
    "    columns_to_pass=[\"spend\", \"signups\"], # The columns to select from the dataframe\n",
    "    # select=output_columns, # The columns to append to the dataframe\n",
    "    # config_required = [\"a\"]\n",
    ")\n",
    "def final_df(initial_df: pl.LazyFrame) -> pl.LazyFrame:\n",
    "    return initial_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "shape: (6, 6)\n",
      "┌─────────┬───────┬───────────────┬──────────────────┬─────────────────┬───────────────────────────┐\n",
      "│ signups ┆ spend ┆ avg_3wk_spend ┆ spend_per_signup ┆ spend_zero_mean ┆ spend_zero_mean_unit_vari │\n",
      "│ ---     ┆ ---   ┆ ---           ┆ ---              ┆ ---             ┆ ance                      │\n",
      "│ i64     ┆ f64   ┆ f64           ┆ f64              ┆ f64             ┆ ---                       │\n",
      "│         ┆       ┆               ┆                  ┆                 ┆ f64                       │\n",
      "╞═════════╪═══════╪═══════════════╪══════════════════╪═════════════════╪═══════════════════════════╡\n",
      "│ 1       ┆ 1e7   ┆ null          ┆ 1e7              ┆ -1.8333e7       ┆ -1.064405                 │\n",
      "│ 10      ┆ 1e7   ┆ null          ┆ 1e6              ┆ -1.8333e7       ┆ -1.064405                 │\n",
      "│ 50      ┆ 2e7   ┆ 13.333333     ┆ 400000.0         ┆ -8.3333e6       ┆ -0.483821                 │\n",
      "│ 100     ┆ 4e7   ┆ 23.333333     ┆ 400000.0         ┆ 1.1667e7        ┆ 0.677349                  │\n",
      "│ 200     ┆ 4e7   ┆ 33.333333     ┆ 200000.0         ┆ 1.1667e7        ┆ 0.677349                  │\n",
      "│ 400     ┆ 5e7   ┆ 43.333333     ┆ 125000.0         ┆ 2.1667e7        ┆ 1.257934                  │\n",
      "└─────────┴───────┴───────────────┴──────────────────┴─────────────────┴───────────────────────────┘\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<!-- Generated by graphviz version 12.1.2 (20240928.0832)\n",
       " -->\n",
       "<!-- Pages: 1 -->\n",
       "<svg width=\"1323pt\" height=\"521pt\"\n",
       " viewBox=\"0.00 0.00 1322.70 520.92\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 516.92)\">\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-516.92 1318.7,-516.92 1318.7,4 -4,4\"/>\n",
       "<g id=\"clust1\" class=\"cluster\">\n",
       "<title>cluster__legend</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"8,-142 8,-326 92.85,-326 92.85,-142 8,-142\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-308.7\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
       "</g>\n",
       "<!-- case -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>case</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"75.3,-50 19.55,-50 19.55,0 81.3,0 81.3,-44 75.3,-50\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"75.3,-50 75.3,-44\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"81.3,-44 75.3,-44\"/>\n",
       "<text text-anchor=\"start\" x=\"35.42\" y=\"-33.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">case</text>\n",
       "<text text-anchor=\"start\" x=\"27.55\" y=\"-5.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">millions</text>\n",
       "</g>\n",
       "<!-- final_df.spend -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>final_df.spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M231.45,-311.8C231.45,-311.8 142.35,-311.8 142.35,-311.8 136.35,-311.8 130.35,-305.8 130.35,-299.8 130.35,-299.8 130.35,-260.2 130.35,-260.2 130.35,-254.2 136.35,-248.2 142.35,-248.2 142.35,-248.2 231.45,-248.2 231.45,-248.2 237.45,-248.2 243.45,-254.2 243.45,-260.2 243.45,-260.2 243.45,-299.8 243.45,-299.8 243.45,-305.8 237.45,-311.8 231.45,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"141.15\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend</text>\n",
       "<text text-anchor=\"start\" x=\"173.02\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>final_df.spend_std_dev</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M460.18,-393.8C460.18,-393.8 312.57,-393.8 312.57,-393.8 306.57,-393.8 300.57,-387.8 300.57,-381.8 300.57,-381.8 300.57,-342.2 300.57,-342.2 300.57,-336.2 306.57,-330.2 312.57,-330.2 312.57,-330.2 460.18,-330.2 460.18,-330.2 466.18,-330.2 472.18,-336.2 472.18,-342.2 472.18,-342.2 472.18,-381.8 472.18,-381.8 472.18,-387.8 466.18,-393.8 460.18,-393.8\"/>\n",
       "<text text-anchor=\"start\" x=\"311.38\" y=\"-370.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_std_dev</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-342.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_std_dev -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_std_dev</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.71,-305.89C255.14,-311.02 267.14,-316.28 278.45,-321 282.2,-322.57 286.04,-324.15 289.92,-325.72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"288.28,-328.84 298.87,-329.33 290.9,-322.35 288.28,-328.84\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>final_df.spend_per_signup</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M471.05,-191.8C471.05,-191.8 301.7,-191.8 301.7,-191.8 295.7,-191.8 289.7,-185.8 289.7,-179.8 289.7,-179.8 289.7,-140.2 289.7,-140.2 289.7,-134.2 295.7,-128.2 301.7,-128.2 301.7,-128.2 471.05,-128.2 471.05,-128.2 477.05,-128.2 483.05,-134.2 483.05,-140.2 483.05,-140.2 483.05,-179.8 483.05,-179.8 483.05,-185.8 477.05,-191.8 471.05,-191.8\"/>\n",
       "<text text-anchor=\"start\" x=\"300.5\" y=\"-168.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_per_signup</text>\n",
       "<text text-anchor=\"start\" x=\"372.5\" y=\"-140.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M222.31,-248.04C238.55,-234 258.67,-218.01 278.45,-206 283.34,-203.03 288.47,-200.15 293.7,-197.38\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.22,-200.54 302.54,-192.89 292.04,-194.3 295.22,-200.54\"/>\n",
       "</g>\n",
       "<!-- final_df.__append -->\n",
       "<g id=\"node9\" class=\"node\">\n",
       "<title>final_df.__append</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1183.85,-398.8C1183.85,-398.8 1071.5,-398.8 1071.5,-398.8 1065.5,-398.8 1059.5,-392.8 1059.5,-386.8 1059.5,-386.8 1059.5,-347.2 1059.5,-347.2 1059.5,-341.2 1065.5,-335.2 1071.5,-335.2 1071.5,-335.2 1183.85,-335.2 1183.85,-335.2 1189.85,-335.2 1195.85,-341.2 1195.85,-347.2 1195.85,-347.2 1195.85,-386.8 1195.85,-386.8 1195.85,-392.8 1189.85,-398.8 1183.85,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1070.3\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.__append</text>\n",
       "<text text-anchor=\"start\" x=\"1093.55\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">LazyFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.75,-250.87C254.98,-246.12 266.89,-241.84 278.45,-239 425.34,-202.97 467.29,-210.32 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean -->\n",
       "<g id=\"node10\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M703.15,-469.8C703.15,-469.8 535.3,-469.8 535.3,-469.8 529.3,-469.8 523.3,-463.8 523.3,-457.8 523.3,-457.8 523.3,-418.2 523.3,-418.2 523.3,-412.2 529.3,-406.2 535.3,-406.2 535.3,-406.2 703.15,-406.2 703.15,-406.2 709.15,-406.2 715.15,-412.2 715.15,-418.2 715.15,-418.2 715.15,-457.8 715.15,-457.8 715.15,-463.8 709.15,-469.8 703.15,-469.8\"/>\n",
       "<text text-anchor=\"start\" x=\"534.1\" y=\"-446.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean</text>\n",
       "<text text-anchor=\"start\" x=\"605.35\" y=\"-418.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge16\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M191.41,-312.19C198.5,-359.52 219.28,-446.45 278.45,-485 358.34,-537.05 471.23,-505.6 544.57,-474.74\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"545.91,-477.98 553.71,-470.8 543.14,-471.55 545.91,-477.98\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean -->\n",
       "<g id=\"node11\" class=\"node\">\n",
       "<title>final_df.spend_mean</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M452.68,-475.8C452.68,-475.8 320.07,-475.8 320.07,-475.8 314.07,-475.8 308.07,-469.8 308.07,-463.8 308.07,-463.8 308.07,-424.2 308.07,-424.2 308.07,-418.2 314.07,-412.2 320.07,-412.2 320.07,-412.2 452.68,-412.2 452.68,-412.2 458.68,-412.2 464.68,-418.2 464.68,-424.2 464.68,-424.2 464.68,-463.8 464.68,-463.8 464.68,-469.8 458.68,-475.8 452.68,-475.8\"/>\n",
       "<text text-anchor=\"start\" x=\"318.88\" y=\"-452.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_mean</text>\n",
       "<text text-anchor=\"start\" x=\"373.62\" y=\"-424.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.spend_mean -->\n",
       "<g id=\"edge18\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.spend_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M204.56,-312.04C220.31,-339.53 246.29,-378.49 278.45,-403 284.4,-407.53 290.91,-411.62 297.69,-415.29\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"295.92,-418.32 306.42,-419.7 299.07,-412.07 295.92,-418.32\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend -->\n",
       "<g id=\"node12\" class=\"node\">\n",
       "<title>final_df.avg_3wk_spend</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M482.3,-311.8C482.3,-311.8 290.45,-311.8 290.45,-311.8 284.45,-311.8 278.45,-305.8 278.45,-299.8 278.45,-299.8 278.45,-260.2 278.45,-260.2 278.45,-254.2 284.45,-248.2 290.45,-248.2 290.45,-248.2 482.3,-248.2 482.3,-248.2 488.3,-248.2 494.3,-254.2 494.3,-260.2 494.3,-260.2 494.3,-299.8 494.3,-299.8 494.3,-305.8 488.3,-311.8 482.3,-311.8\"/>\n",
       "<text text-anchor=\"start\" x=\"289.25\" y=\"-288.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.avg_3wk_spend: case</text>\n",
       "<text text-anchor=\"start\" x=\"372.5\" y=\"-260.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend&#45;&gt;final_df.avg_3wk_spend -->\n",
       "<g id=\"edge19\" class=\"edge\">\n",
       "<title>final_df.spend&#45;&gt;final_df.avg_3wk_spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M243.7,-280C251.06,-280 258.82,-280 266.76,-280\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"266.57,-283.5 276.57,-280 266.57,-276.5 266.57,-283.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1018.5,-398.8C1018.5,-398.8 756.15,-398.8 756.15,-398.8 750.15,-398.8 744.15,-392.8 744.15,-386.8 744.15,-386.8 744.15,-347.2 744.15,-347.2 744.15,-341.2 750.15,-335.2 756.15,-335.2 756.15,-335.2 1018.5,-335.2 1018.5,-335.2 1024.5,-335.2 1030.5,-341.2 1030.5,-347.2 1030.5,-347.2 1030.5,-386.8 1030.5,-386.8 1030.5,-392.8 1024.5,-398.8 1018.5,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"754.95\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.spend_zero_mean_unit_variance</text>\n",
       "<text text-anchor=\"start\" x=\"873.45\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge14\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean_unit_variance&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1030.76,-367C1036.54,-367 1042.25,-367 1047.83,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.55,-370.5 1057.55,-367 1047.55,-363.5 1047.55,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>final_df</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M1302.7,-398.8C1302.7,-398.8 1236.85,-398.8 1236.85,-398.8 1230.85,-398.8 1224.85,-392.8 1224.85,-386.8 1224.85,-386.8 1224.85,-347.2 1224.85,-347.2 1224.85,-341.2 1230.85,-335.2 1236.85,-335.2 1236.85,-335.2 1302.7,-335.2 1302.7,-335.2 1308.7,-335.2 1314.7,-341.2 1314.7,-347.2 1314.7,-347.2 1314.7,-386.8 1314.7,-386.8 1314.7,-392.8 1308.7,-398.8 1302.7,-398.8\"/>\n",
       "<text text-anchor=\"start\" x=\"1245.78\" y=\"-375.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df</text>\n",
       "<text text-anchor=\"start\" x=\"1235.65\" y=\"-347.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">LazyFrame</text>\n",
       "</g>\n",
       "<!-- final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>final_df.spend_std_dev&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M472.58,-362.85C543.7,-363.57 646.89,-364.6 732.42,-365.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"732.28,-368.96 742.31,-365.56 732.35,-361.96 732.28,-368.96\"/>\n",
       "</g>\n",
       "<!-- initial_df -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>initial_df</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M83.35,-131.8C83.35,-131.8 17.5,-131.8 17.5,-131.8 11.5,-131.8 5.5,-125.8 5.5,-119.8 5.5,-119.8 5.5,-80.2 5.5,-80.2 5.5,-74.2 11.5,-68.2 17.5,-68.2 17.5,-68.2 83.35,-68.2 83.35,-68.2 89.35,-68.2 95.35,-74.2 95.35,-80.2 95.35,-80.2 95.35,-119.8 95.35,-119.8 95.35,-125.8 89.35,-131.8 83.35,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"22.67\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">initial_df</text>\n",
       "<text text-anchor=\"start\" x=\"16.3\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">LazyFrame</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.spend -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.spend</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M89.93,-132.1C91.82,-134.04 93.64,-136.02 95.35,-138 122.03,-168.87 146.53,-208.28 163.3,-237.75\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"160.21,-239.4 168.15,-246.4 166.31,-235.97 160.21,-239.4\"/>\n",
       "</g>\n",
       "<!-- final_df.signups -->\n",
       "<g id=\"node8\" class=\"node\">\n",
       "<title>final_df.signups</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M237.45,-131.8C237.45,-131.8 136.35,-131.8 136.35,-131.8 130.35,-131.8 124.35,-125.8 124.35,-119.8 124.35,-119.8 124.35,-80.2 124.35,-80.2 124.35,-74.2 130.35,-68.2 136.35,-68.2 136.35,-68.2 237.45,-68.2 237.45,-68.2 243.45,-68.2 249.45,-74.2 249.45,-80.2 249.45,-80.2 249.45,-119.8 249.45,-119.8 249.45,-125.8 243.45,-131.8 237.45,-131.8\"/>\n",
       "<text text-anchor=\"start\" x=\"135.15\" y=\"-108.7\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">final_df.signups</text>\n",
       "<text text-anchor=\"start\" x=\"173.02\" y=\"-80.7\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Expr</text>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.signups -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.signups</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.83,-100C101.33,-100 107.06,-100 112.85,-100\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"112.5,-103.5 122.5,-100 112.5,-96.5 112.5,-103.5\"/>\n",
       "</g>\n",
       "<!-- initial_df&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge15\" class=\"edge\">\n",
       "<title>initial_df&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M620.23,-220C776.95,-229.59 950.98,-292.31 1048.79,-332.66\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1047.2,-335.79 1057.78,-336.4 1049.89,-329.33 1047.2,-335.79\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M387.38,-100C433.3,-114.84 450.42,-98.89 494.3,-119 558.89,-148.61 548.22,-207.83 618.23,-220\"/>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M95.79,-70.39C104.89,-65.69 114.66,-61.54 124.35,-59 237.95,-29.25 273.63,-63.89 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_per_signup&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge12\" class=\"edge\">\n",
       "<title>final_df.spend_per_signup&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M478.73,-192.28C520.63,-204.86 571.32,-216.99 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.spend_per_signup -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.spend_per_signup</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.84,-118.82C258.96,-121.59 268.57,-124.51 278.29,-127.46\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"277.26,-130.81 287.85,-130.37 279.29,-124.11 277.26,-130.81\"/>\n",
       "</g>\n",
       "<!-- final_df.signups&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>final_df.signups&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M249.92,-90.37C289.6,-86.54 341.66,-85.87 385.38,-100\"/>\n",
       "</g>\n",
       "<!-- final_df.__append&#45;&gt;final_df -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>final_df.__append&#45;&gt;final_df</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M1196.26,-367C1202,-367 1207.75,-367 1213.38,-367\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1213.17,-370.5 1223.17,-367 1213.17,-363.5 1213.17,-370.5\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.spend_zero_mean_unit_variance</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.54,-412.57C728.24,-409.18 741.44,-405.66 754.62,-402.14\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"755.46,-405.54 764.22,-399.58 753.65,-398.78 755.46,-405.54\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_zero_mean&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge13\" class=\"edge\">\n",
       "<title>final_df.spend_zero_mean&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M715.28,-439.84C799.32,-439.41 924.66,-433.68 1030.5,-408 1036.4,-406.57 1042.4,-404.81 1048.37,-402.84\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"1049.36,-406.2 1057.63,-399.58 1047.04,-399.6 1049.36,-406.2\"/>\n",
       "</g>\n",
       "<!-- final_df.spend_mean&#45;&gt;final_df.spend_zero_mean -->\n",
       "<g id=\"edge17\" class=\"edge\">\n",
       "<title>final_df.spend_mean&#45;&gt;final_df.spend_zero_mean</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M464.89,-441.99C479.85,-441.6 495.78,-441.18 511.49,-440.77\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"511.45,-444.28 521.36,-440.52 511.27,-437.28 511.45,-444.28\"/>\n",
       "</g>\n",
       "<!-- final_df.avg_3wk_spend&#45;&gt;final_df.__append -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>final_df.avg_3wk_spend&#45;&gt;final_df.__append</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M462.35,-247.73C506.94,-231.78 565.02,-216.59 618.23,-220\"/>\n",
       "</g>\n",
       "<!-- config -->\n",
       "<g id=\"node13\" class=\"node\">\n",
       "<title>config</title>\n",
       "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"71.42,-186 23.42,-186 23.42,-150 77.42,-150 77.42,-180 71.42,-186\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"71.42,-186 71.42,-180\"/>\n",
       "<polyline fill=\"none\" stroke=\"black\" points=\"77.42,-180 71.42,-180\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-162.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">config</text>\n",
       "</g>\n",
       "<!-- function -->\n",
       "<g id=\"node14\" class=\"node\">\n",
       "<title>function</title>\n",
       "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-240.3C72.85,-240.3 28,-240.3 28,-240.3 22,-240.3 16,-234.3 16,-228.3 16,-228.3 16,-215.7 16,-215.7 16,-209.7 22,-203.7 28,-203.7 28,-203.7 72.85,-203.7 72.85,-203.7 78.85,-203.7 84.85,-209.7 84.85,-215.7 84.85,-215.7 84.85,-228.3 84.85,-228.3 84.85,-234.3 78.85,-240.3 72.85,-240.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-216.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
       "</g>\n",
       "<!-- output -->\n",
       "<g id=\"node15\" class=\"node\">\n",
       "<title>output</title>\n",
       "<path fill=\"#ffc857\" stroke=\"black\" d=\"M67.97,-295.3C67.97,-295.3 32.87,-295.3 32.87,-295.3 26.87,-295.3 20.87,-289.3 20.87,-283.3 20.87,-283.3 20.87,-270.7 20.87,-270.7 20.87,-264.7 26.87,-258.7 32.87,-258.7 32.87,-258.7 67.97,-258.7 67.97,-258.7 73.97,-258.7 79.97,-264.7 79.97,-270.7 79.97,-270.7 79.97,-283.3 79.97,-283.3 79.97,-289.3 73.97,-295.3 67.97,-295.3\"/>\n",
       "<text text-anchor=\"middle\" x=\"50.42\" y=\"-271.2\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<graphviz.graphs.Digraph at 0x7f85ca94dab0>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import with_columns_lazy_example\n",
    "from hamilton import base\n",
    "from hamilton.plugins import h_polars\n",
    "\n",
    "dr = (\n",
    "    driver.Builder()\n",
    "    .with_adapter(\n",
    "        adapter=base.SimplePythonGraphAdapter(result_builder=h_polars.PolarsDataFrameResult()))\n",
    "    .with_modules(my_functions_lazy, with_columns_lazy_example)\n",
    "    .with_config({\"case\":\"millions\"})\n",
    "    .build()\n",
    "    )\n",
    "print(dr.execute(final_vars=[\"final_df\"]))\n",
    "dr.visualize_execution(final_vars=[\"final_df\"])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "hamilton",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
